package com.william.yun.yunliwuli.api.rest;

import com.alibaba.fastjson.JSONObject;
import com.william.yun.yunliwuli.api.request.login.LoginRequest;
import com.william.yun.yunliwuli.api.response.login.LoginOkResponse;
import com.william.yun.yunliwuli.service.BaseService;
import com.william.yun.yunliwuli.service.impl.BaseServiceImpl;

/**
 * 登录
 * @Date 2021-03-11
 * @author william
 */
public class LoginApi extends BaseApi {
    /**
     * 登录
     * @param loginRequest
     * @return
     */
    public LoginOkResponse login(LoginRequest loginRequest){
        BaseService baseService = new BaseServiceImpl();
        JSONObject login = baseService.login(loginRequest.getUsername(), loginRequest.getPassword());
        return JSONObject.toJavaObject(login, LoginOkResponse.class);
    }

}
